package com.geek;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesServlet extends HttpServlet {


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("doget-------------");
        InputStream is= this.getServletContext().getResourceAsStream("/WEB-INF/classes/file.properties");
        Properties properties=new Properties();
        properties.load(is);
        String address=properties.getProperty("address");
        System.out.println(address);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("dopost-------------");
       super.doPost(req, resp);
    }
}
